
import pandas as pd, numpy as np, matplotlib.pyplot as plt

# 折线图
def   line_chart():
    df = pd.DataFrame(np.random.randn(10,2), columns=list('AB'))
    df.plot()
    plt.show()


import pandas as pd, numpy as np, matplotlib.pyplot as plt
# 条形图
def bar_chart():
    df = pd.DataFrame(np.random.rand(5,3), columns=list('ABC'))
    df.plot.bar()
    plt.show()

# 横直条形图
def barh_chart():
    df = pd.DataFrame(np.random.rand(5,3), columns=list('ABC'))
    df.plot.barh()
    plt.show()

# 直方图
def hist_chart():
    df = pd.DataFrame({

            'A':np.random.randn(800)+1, 'B':np.random.randn(800)}, columns=list('AB'))
    df.plot.hist(bins=10)
    plt.show()

# 直方图 AB分开
def hist_chart_AB():
    df = pd.DataFrame({

            'A':np.random.randn(800)+1, 'B':np.random.randn(800)}, columns=list('AB'))
    df.hist(bins=10)
    plt.show()

# 散点图
def scatter_chart():
    df = pd.DataFrame(np.random.rand(20, 2), columns=list('AB'))
    df.plot.scatter(x='A', y='B')
    plt.show()

# 饼图
def pie_chart():
    df = pd.DataFrame([30, 20, 50], index=list('ABC'), columns=[''])
    df.plot.pie(subplots=True)
    plt.show()


if __name__ == '__main__':
    #line_chart()
    #bar_chart()
    #barh_chart()
    #hist_chart()
    #hist_chart_AB()
    #scatter_chart()
    pie_chart()
